#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>

class Solution {
public:
    int maxArea(vector<int>& height)
    {
        int left = 0, right = height.size() - 1;
        int maxContainer = 0;

        while (left < right)
        {
            int heightMin = min(height[left], height[right]);
            maxContainer = max(maxContainer, heightMin * (right - left));

            if (height[left] < height[right])
                left++;
            else
                right--;
        }
        return maxContainer;
    }
};